import React from 'react'
import { Layout, Affix } from 'antd'
import { Route, Switch } from 'react-router-dom'
import HomeRoute from '@views/home/homeRoute'
import { BASE_URL } from '@utils/routes'
import MENU from '@utils/menu'
import CustomHeader from '@/components/CustomHeader/index'
import CustomFooter from '@/components/CustomFooter/index'
import AboutUsRoute from './aboutUs/aboutUsRoute.js'
import NewsRoute from './news/newsRoute.js'
import ScientificResearch from './scientificResearch/route.js'
import ContactUs from './contactUs/route.js'
import JoinUs from './joinUs/route.js'

const { Header, Content } = Layout
const { DATA } = MENU

export default class IndexRoute extends React.PureComponent {
    constructor(props) {
        super(props)
    }
    
    render() {
        window.scrollTo(0, 0)
        return (
            <div>
                <Layout>
                    <Affix offsetTop={0} style={{zIndex: 999, height: '78px'}}>
                        <Header style={{padding: 0}}>
                            <CustomHeader navData={DATA} />
                        </Header>
                    </Affix>
                    <Content>
                        <Switch>
                            <Route path={BASE_URL + '/home'} component={HomeRoute}></Route>
                            <Route path={BASE_URL + "/aboutUs"} component={AboutUsRoute}></Route>
                            <Route path={BASE_URL + "/news"} component={NewsRoute}></Route>
                            <Route path={BASE_URL + "/contactUs"} component={ContactUs}></Route>
                            <Route path={BASE_URL + "/scientificResearch"} component={ScientificResearch}></Route>
                            <Route path={BASE_URL + "/joinUs"} component={JoinUs}></Route>

                            <Route path={BASE_URL + '/'} component={HomeRoute}></Route>
                        </Switch>
                    </Content>
                    <CustomFooter navData={DATA}/>
                </Layout>
            </div>
        )
    }
}